import java.util.HashSet;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        int l = Integer.numberOfLeadingZeros(10);
    }
}
class Solution1 {
    public int findMaximumXOR(int[] nums) {
        int max = 0;
        for(int x : nums){
            if(x > max) max = x;
        }
        int k = 31 - Integer.numberOfLeadingZeros(max);
        int mask=0, ans=0;
        Set<Integer> set = new HashSet<>();
        for(int i=k; i>=0; i--){
            set.clear();
            mask |= 1<<i;
            int newAns = ans | (1<<i);
            for(int x : nums){
                x &= mask;
                if(set.contains(newAns^x)){
                    ans = newAns;
                    break;
                }
                set.add(x);
            }
        }
        return ans;
    }
}
class Solution {
    public int maxProduct(String[] words) {
        int n = words.length;
        int[] mask = new int[n];
        int idx = 0;
        for(String x : words){
            int t = 0;
            for(int i=0; i<x.length(); i++){
                int u = x.charAt(i)-'a';
                t |= (1<<u);
            }
            mask[idx++] = t;
        }
        int ans = 0;
        for(int i=0; i<n; i++){
            for(int j=0; j<i; j++){
                if((mask[i] & mask[j])==0)
                    ans = Math.max(ans,words[i].length()*words[j].length());
            }
        }
        return ans;
    }
}
